import {Auth, Group, Role} from "@/services";
import {BackendDictDisplay, EntityId, PageQueryParams} from "kf-web-library";


export interface UserPageQueryParams extends Partial<PageQueryParams> {
  ids?: EntityId[];
  searchText?: string;
  gender?: string;
  enabled?: boolean;
  locked?: boolean;
  groupId?: number;
  bizGroupCode?: string;
  roleNameOrCode?: string;
  roleCodes?: string[];
  type?: string | string[];
}

export interface User {
  id: EntityId;
  nickname: string; //姓名

  type: BackendDictDisplay;
  avatar: string; //头像
  gender: string; //性别
  phone: string; //联系电话
  email: string; //联系电话
  officeLocation: string; //办公地点(办理点位)
  enabled: boolean; //是否启用
  locked: boolean; //是否锁定
  createTime: string; //创建时间
  roles?: Role[];
  groups?: Group[];
  auths?: Auth[];
  description: string; //备注
  center: string;
}


export interface User_Summary {
  id: EntityId;
  nickname: string; //姓名
  type: BackendDictDisplay;
  avatar: string; //头像
  gender: 'MALE' | 'FEMALE'; //性别
  phone: string; //联系电话
  officeLocation: string; //办公地点(办理点位)
}

export interface User_Integration{
  id: number;
  nickname: string; //姓名
  avatar: string; //头像
  gender: 'MALE' | 'FEMALE'; //性别
  phone: string; //联系电话
}


export interface User_Create {
  nickname: string; //姓名
  type: string;
  avatar: string; //头像
  officeLocation: string; //办公地点(办理点位)
  gender: string; //性别
  phone: string; //联系电话
  description: string; //备注
  roleIds: number[]; //拥有的角色
  groupIds: number[]; //所在的组
  identifier: string; //登录标识
  credential: string; //密码凭证
  center: string;
}


export interface User_Modify {
  id: EntityId;
  nickname: string; //姓名
  type: string;
  avatar: string; //头像
  gender: string; //性别
  phone: string; //联系电话
  officeLocation: string; //办公地点(办理点位)
  description: string; //备注
  center: string;
}

export interface User_FullModify extends User_Modify {
  roleIds: number[];  //拥有的角色
  groupIds: number[]; //所在的组织机构
}


export interface User_Patch extends Partial<User_Modify> {
  id: EntityId;
}

export interface User_FullPatch extends Partial<User_FullModify> {
  id: EntityId;
}

